package com.choosefine.springboot.devops.participate.service;

import com.choosefine.springboot.devops.activity.model.Activity;
import com.choosefine.springboot.devops.base.service.BaseService;
import com.choosefine.springboot.devops.participate.model.Participate;
import org.beetl.sql.core.SQLManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import redis.clients.jedis.Jedis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ParticipateService extends BaseService {
	@Autowired
	private SQLManager sqlManager;

	public Participate selectById(Integer id){
		Map<String,Object> param=new HashMap<String, Object>();
		param.put("id",id);
		Participate result=sqlManager.selectSingle("participate.selectById",param,Participate.class);
		return result;
	}

	public Participate selectByActAndWxCode(String wxCode,Integer activityId){
		Participate participate=new Participate();
		participate.setActivityId(activityId);
		participate.setWxCode(wxCode);
		Participate result=sqlManager.selectSingle("participate.selectWxCodeAndActivity",participate,Participate.class);
		return result;
	}

	public List<Participate> selectList(long pageNum,long pageSize){
		List<Participate> list=sqlManager.select("participate.selectList",Participate.class,null);
		return  list;
	}
}
